<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function f1(){
				let df=document.createDocumentFragment()
				for (let i = 0; i < 10; i++) {
					let node=document.createElement("div")
					node.innerHTML="文字节点"
					df.appendChild(node)
				}
				
				/* document.querySelector(".con").appendChild(df) */
				document.getElementsByClassName("con")[0].appendChild(df)
			}
			function f2(){
				let df=document.createDocumentFragment()
				for (let i = 0; i < 10; i++) {
					let node=document.createElement("img")
					node.setAttribute("src","../src/ok.png")
					df.appendChild(node)
				}
				document.querySelector(".con").appendChild(df)
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="f1()">添加十个文本</button>
		<button type="button" onclick="f2()">添加十个图片</button>
		<div class="con"></div>
	</body>
</html>

